---
import { type CollectionEntry, getCollection } from "astro:content";
import ProjectLayout from "~/layouts/ProjectLayout.astro";

export async function getStaticPaths() {
	const postEntries = await getCollection("projects");
	return postEntries.map((entry) => ({
		params: { slug: entry.slug },
		props: { entry },
	}));
}

type Props = {
	entry: CollectionEntry<"projects">;
};

const { entry } = Astro.props;
const { Content } = await entry.render();
---

<ProjectLayout frontmatter={entry.data} slug={entry.slug}>
	<Content />
</ProjectLayout>
